/*  This file is part of LitSearch.

    LitSearch is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    LitSearch is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with LitSearch; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */

package de.fhbrs.litsearch;

import com.softtech.jdbc.SQLResults;

/**
 * Reads Frequently Asked Questions from DB
 *
 * @version 	1.0 26 Jan 2005
 * @author 	Christian Clever
 * 
 */
public class Faq {
	
	/**
	 * Empty constructor
	 *
	 */
	public Faq(){
		
	}
	
	/**
	 * Reads FAQ from DB and returns them as a HTML-table
	 * @return FAQ as HTML-table contents
	 */
	public String getFaq(){
		
		String myReturn="";
		JDBCBean dbCon= new JDBCBean();
		
		SQLResults res = dbCon.getResultSet("select * from faq order by no  ");
		
		
		
		for(int i=0;i<res.getRowCount();i++){
			String q=res.getString(i,"question");
			String a=res.getString(i,"answer");
			
		myReturn+="<tr><td><b>"+q+"</b></td></tr>";
		myReturn+="<tr><td>"+a+"</td></tr>";
		}
		return myReturn;
	}
}
